﻿{% extends 'inquire/base.html' %}

{% block title %}
    房间资产查询区
{% endblock %}

{% block startbody %}
    {#查询后的显示部分#}
    <div class="container">
        <div class="page-header">
            <h1>{{ room }}</h1>
        </div>
        <p class="lead">Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom
            HTML and CSS. A fixed navbar has been added with <code>padding-top: 60px;</code> on the <code>body &gt;
                .container</code>.</p>
        <p>Back to <a href="#">the default sticky footer</a> minus the navbar.</p>
    </div>

    {#查询和结果#}
    <div class="container">
        <div class="row">
            {#查询一#}
            <form action='{% url "ribbon:room_asset_query" %}'>
                <div class="form-group col-sm-6 col-xs-6">
                    <label for="exampleInputEmail1">通过房间进行资产查询:</label>
                    <select class="form-control" id="exampleInputEmail1" name="asset">
                        {#		                <option>请选择要查询的房间....</option>#}
                        {% for id,name in all_room.items %}
                            {% if room_id == id %}
                                {#selected 默认选择#}
                                <option value='{{ id }}' selected>{{ name }}</option>
                            {% else %}
                                <option value='{{ id }}'>{{ name }}</option>
                            {% endif %}
                        {% endfor %}
                    </select>
                </div>
                <br>
                <div class="form-group col-sm-6 col-xs-6">
                    <label for="exampleInputEmail1">&emsp;</label>
                    <button type="submit" class="btn btn-default">查询</button>
                </div>
            </form>
            <hr>

            {#查询结果#}
            <div>
                <table class="table table-hover">
                    <caption>Optional table caption.</caption>
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>物品</th>
                        <th>存放地址</th>
                        <th>保管员</th>
                        <th>数量</th>
                        <th>单位</th>
                        <th></th>
                    </tr>
                    </thead>
                    <tbody>

                    {% for foo in info %}
                        <tr>
                            <td>{{ forloop.counter }}</td>
                            <td>{{ foo.goods__name }}</td>
                            <td>{{ room }}</td>
                            <td>{{ foo.user__name }}</td>
                            <td>{{ foo.number }}</td>
                            <td>{{ foo.unit }}</td>
                            <td>
                                <a href="{% url 'asset_search:amend' uid=foo.id %}" class="btn btn-primary">修改</a>
                                <a href="{% url 'asset_turn:asset_turn' %}?stockcontrol_id={{ foo.id }}"
                                   class="btn btn-primary">转移</a>
                            </td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
{% endblock %}
	



    

